import Vue from 'test'

//require.context()  加载指定文件

//Vue.prototype.$http = {...}

let files = require.context('./',false,/\.js$/);
console.log("keys",files.keys().filter(item => !item.includes('index')));

let $api = files.keys().filter(item => !item.includes('index')).reduce((prev,cur) => {
    //cur  
    console.log(files(cur).default) //抛出对象 {getListenData(){},getLookData(){},....}

    return {
        ...prev,
        ...files(cur).default
    }
},{})

console.log("=====$api",$api)

Vue.prototype.$http = $api;